package edu.scut.course_management.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataAccessException;

import edu.scut.course_management.dto.SADetailInfoDTO;
import edu.scut.course_management.dto.SectionPlusStudentIdDTO;
import edu.scut.course_management.po.Homework;
import edu.scut.course_management.po.Section;
import org.springframework.stereotype.Repository;

/**
 * 数据访问，对应库表：homework
 * 
 * @author huaming
 */
@Repository
public interface HomeworkMapper {
    
    // 创建作业 采用主键回填
    void addHomework(Homework homework) throws DataAccessException;

    // 通过homework_id来查询homework记录
    Homework findHomeworkByHomeworkId(@Param("homeworkId")Integer homeworkId);

    // 通过section查section_homework与homework表 最后找出所有homework记录
    List<Homework> findHomeworkBySection(Section section);

    // 通过section类的数据与一个studentId去查询homework和answer对应的内容 并筛选放入到dto中
    List<SADetailInfoDTO> findSADetailInfoDTOsBySectionPlusStudentId(SectionPlusStudentIdDTO sectionPlusStudentIdDTO);
}
